<?php
date_default_timezone_set('PRC');
include_once("./excel/excel.php");
include_once("./Db_pdo.class.php");
//添加 刷手页面
echo '<pre>';
$DB=new Db_pdo("test","root","root");
set_time_limit(0);


$s = new excel();
$data = $s->dtext("./area.xlsx"); 
// foreach ($data as $key => $value) {
// 	if($value['0']){
// 		$arr[]= $value;
// 	}
// }


// echo '<pre>';
// print_r($data);

$arr = array_chunk($data, 500);
foreach($arr as $v) {
	$sql = "INSERT INTO area (`name`,`code`,`level`,`p_name`,`p_code`) VALUES ";
	foreach ($v as $value) { 
		

		$param['name'] =$value['1'];
		$param['code'] = $value['2'];
		$param['level'] =$value['3'];
		$param['p_name'] =$value['4'];
		$param['p_code'] = $value['5'];
		
		// $s.='(null,3,'.$value['id'].','.$value['need_back'].',0,0,'.$value['user_id'].','.$value['back_time'].'),';
		// echo $s;
	    $values="('".implode("','",array_values($param))."'),";
	    // echo $values;
	    $sql .= $values;
	}
	$sql = rtrim($sql, ",");
	$DB->db->query($sql);
	// return ;
}